namespace WebCalendar.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AppointmentRequest2 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AppointmentRequests",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        URLCode = c.Guid(nullable: false),
                        RequestorName = c.String(),
                        RequestorPhoneNumber = c.String(),
                        RequestorEmail = c.String(),
                        RequestDate = c.DateTime(nullable: false),
                        RequestedStartDate = c.DateTime(nullable: false),
                        RequestedEndDate = c.DateTime(),
                        IsAllDay = c.Boolean(nullable: false),
                        RequestorUserProfile_UserId = c.Int(),
                        Calendar_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.UserProfile", t => t.RequestorUserProfile_UserId)
                .ForeignKey("dbo.Calendars", t => t.Calendar_ID)
                .Index(t => t.RequestorUserProfile_UserId)
                .Index(t => t.Calendar_ID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.AppointmentRequests", new[] { "Calendar_ID" });
            DropIndex("dbo.AppointmentRequests", new[] { "RequestorUserProfile_UserId" });
            DropForeignKey("dbo.AppointmentRequests", "Calendar_ID", "dbo.Calendars");
            DropForeignKey("dbo.AppointmentRequests", "RequestorUserProfile_UserId", "dbo.UserProfile");
            DropTable("dbo.AppointmentRequests");
        }
    }
}
